//
//  ImageMutLineLabelView.m
//  HuaRun2
//
//  Created by admin on 17/9/2.
//  Copyright © 2017年 Sunny. All rights reserved.
//

#import "ImageMutLineLabelView.h"
#import "ImageLabView.h"
@implementation ImageMutLineLabelView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
#pragma mark - life cycle
- (void)dealloc {
    NSLog(@"%@ dealloc", [self class]);
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self viewInit];
        [self layoutInit];
    }
    return self;
}

- (void)viewInit {
    self.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.timeBtn];
    [self addSubview:self.timeLab];
}

- (void)layoutInit {
    
    weakself(ws);
    
    [self.timeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws).offset(0);
        make.left.mas_equalTo(ws).offset(0);
        make.size.mas_equalTo(CGSizeMake(15, 15));
    }];

    [self.timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ws.timeBtn);
        make.left.mas_equalTo(ws.timeBtn.mas_right).offset(kMargin10);
        make.right.mas_equalTo(ws.mas_right).offset(-0);
    }];
    
    [self mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.mas_equalTo(ws);
        make.bottom.mas_equalTo(ws.timeLab).offset(kMargin10);
    }];
}
//label 多行显示
- (UILabel *)timeLab {
    if (!_timeLab) {
        self.timeLab = [UILabel new];
        _timeLab.textAlignment = NSTextAlignmentLeft;
        _timeLab.font = kGeneralFontSize;
        _timeLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _timeLab.numberOfLines = 0;

    }
    return _timeLab;
}


- (UIButton *)timeBtn {
    if (!_timeBtn) {
        self.timeBtn = [UIButton new];
        [_timeBtn setBackgroundImage:[UIImage imageNamed:@"lianxiren_juese1"]
                            forState:(UIControlStateNormal)];
    }
    return _timeBtn;
}
@end
